/**
 * @flow
 * https://reactnavigation.org/docs/screen-options-resolution
 */
import React from 'react'
import {NavigationContainer} from '@react-navigation/native'
import {createNativeStackNavigator} from '@react-navigation/native-stack'
import ScreenConfig from './ScreenConfig'
const Stack = createNativeStackNavigator()

import Main from './tab'
import Login from '@p/login/login'
import HomeDunHuang from '@p/home/homeDunHuang'
import HomeFloat from '@p/home/homeFloat'

export default function NavTor() {
  return (
    <NavigationContainer>
      <Stack.Navigator initialRouteName='Main' screenOptions={{headerShown: false}}>
        <Stack.Group>
          <Stack.Screen
            name='Main'
            component={Main}
            options={props => ScreenConfig(props, Main)}
          />
          <Stack.Screen
            name='homeDunHuang'
            component={HomeDunHuang}
            options={props => ScreenConfig(props, HomeDunHuang)}
          />
          <Stack.Screen
            name='homeFloat'
            component={HomeFloat}
            options={props => ScreenConfig(props, HomeFloat)}
          />
        </Stack.Group>
        <Stack.Group screenOptions={{presentation: 'modal'}}>
          <Stack.Screen
            name='login'
            component={Login}
            options={props => ScreenConfig(props, Login)}
          />
        </Stack.Group>
      </Stack.Navigator>
    </NavigationContainer>
  )
}
